package com.veng.springbootdemo.dao;

import com.veng.springbootdemo.po.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

@Repository
public interface UserRepository extends JpaRepository<User, Long> {
    User findByUserName(String userName);
    User findByEmail(String email);
    User findByUserNameOrEmail(String username, String email);
    User findFirstByOrderByUserNameAsc();

    @Modifying
    @Query("update User set password = ?2 where userName = ?1")
    void modifyPasswordByUsername(String username,String password);
}
